package whf.framework.security.service;

import java.util.List;

import whf.framework.exception.DAOException;
import whf.framework.exception.FindException;
import whf.framework.security.entity.Group;
import whf.framework.security.entity.Role;
import whf.framework.security.entity.User;

/**
 * @author wanghaifeng
 * @email king@126.com
 * @modify 2006-05-31
 */
//@WebService
public interface UserService extends whf.framework.service.Service<User> {

	/**
	 * @modify wanghaifeng Aug 31, 2006 1:00:10 PM
	 * @param username
	 * @param password
	 * @return
	 * @throws FindException
	 */
	public User findByUsernamePassword(String username, String password) throws FindException;
	
	/**
	 * @modify wanghaifeng Aug 31, 2006 1:00:10 PM
	 * @param username
	 * @return
	 * @throws FindException
	 */
	public User findByUsername(String username) throws FindException;

	/**
	 * 设置用户的用户组,主题是用户
	 * @modify wanghaifeng Aug 31, 2006 1:01:55 PM
	 * @param user
	 * @param groups
	 * @throws DAOException
	 */
	public void assignUserGroups(User user, List<Group> groups) throws DAOException;
	
	/**
	 * 设置user的角色为roles
	 * 1、如果user已经存在roles中则不做任何动作
	 * 2、如果user所在的角色不在roles中，则需要删除
	 * 3、如果user不在roles中的角色中则需要增加
	 * @param user
	 * @param roles
	 * @throws DAOException
	 */
	public void assignUserRoles(User user, List<Role> roles) throws DAOException;
	
	/**
	 * 用户激活
	 * @modify wanghaifeng Mar 27, 2007 9:35:05 PM
	 * @param user
	 * @throws DAOException
	 */
	public void activate(User user) throws DAOException;
	
	/**
	 * 用户反激活
	 * @modify wanghaifeng Mar 27, 2007 9:35:17 PM
	 * @param user
	 * @throws DAOException
	 */
	public void deactivate(User user) throws DAOException;
} 